// 与api通信的地方
import { getBannerRequest } from '../../../api/request'

// compon -> action -> api then ->dispatch(action-type) ->reducer -> 新的值
export const changeBannerList = (data) => ({
    type: 'CHANGE_BANNER',
    data: data
  })
//异步
export const getBannerList = () => {
    return (dispatch) => {
        getBannerRequest()
            .then(data => {
                // dispatch 有格式要求
                console.log(data + '---|||---')
                dispatch(changeBannerList(data.banners))
            })
    }
}